<!doctype html>
<a download>link</a>
<script>
  var anchorElement = document.querySelector('a[download]');
  url = window.location.href;
  anchorElement.href = url.substr(url.indexOf('=') + 1);

  window.addEventListener('message', function (evt) {
    anchorElement.click();
  }, false);
</script>
